Data inladen

Baits<-read.table(file = "~/GitHub/vespa_analyses/Input/Baits_useful.txt", header=TRUE, sep="\t", na.strings=c(""," ","NA"))

Flights_incomplete<-read.table(file = "~/GitHub/vespa_analyses/Input/Flights_incomplete.txt", header=TRUE, sep="\t", na.strings=c(""," ","NA"))

Nests<-read.table(file = "~/GitHub/vespa_analyses/Input/Nests_useful.txt", header=TRUE, sep="\t", na.strings=c(""," ","NA"))

Shortind_incomplete<-read.table(file = "~/GitHub/vespa_analyses/Input/Shortind_incomplete.txt", header=TRUE, sep="\t", na.strings=c(""," ","NA"))

Shortpot_incomplete<-read.table(file = "~/GitHub/vespa_analyses/Input/Shortpot_incomplete.txt", header=TRUE, sep="\t", na.strings=c(""," ","NA"))

Individuals<-read.table(file = "~/GitHub/vespa_analyses/Input/Individuals.txt", header=TRUE, sep="\t", na.strings=c(""," ","NA"))

-incomplete wil zeggen dat de weergegevens nog niet volledig zijn. Ik wacht hiervoor op het KMI.

Aanpassingen datasets

# Overbodige kolommen wegdoen, foutje in excel
Flights_incomplete<-Flights_incomplete[1:(length(Flights_incomplete)-2)]
Shortind_incomplete<-Shortind_incomplete[1:(length(Shortind_incomplete)-2)]
Shortpot_incomplete<-Shortpot_incomplete[1:(length(Shortpot_incomplete)-2)]

#Foerageersnelheid en vliegsnelheid (m/s) toevoegen aan tabel
Flights_incomplete$test_rule_of_thumb<-Flights_incomplete$Distance/(Flights_incomplete$Flighttime_min*60)
Shortind_incomplete$test_rule_of_thumb<-Shortind_incomplete$Distance/(Shortind_incomplete$Flighttime_min*60)
Shortpot_incomplete$test_rule_of_thumb<-Shortpot_incomplete$Distance/(Shortpot_incomplete$Flighttime_min*60)

Flights_incomplete$ForagingSpeed<-Flights_incomplete$Distance*2/(Flights_incomplete$Flighttime_min*60)
Shortind_incomplete$ForagingSpeed<-Shortind_incomplete$Distance*2/(Shortind_incomplete$Flighttime_min*60)
Shortpot_incomplete$ForagingSpeed<-Shortpot_incomplete$Distance*2/(Shortpot_incomplete$Flighttime_min*60)


## Urbanisatiecirkels per vliegtijd toevoegen
Flights_incomplete<-merge(Flights_incomplete, Baits[, c("NestID", "BaitID", "Urbanisation25m", "Urbanisation50m", "Urbanisation100m")], by=c("NestID", "BaitID"), all=TRUE)
Shortind_incomplete<-merge(Shortind_incomplete, Baits[, c("NestID", "BaitID", "Urbanisation25m", "Urbanisation50m", "Urbanisation100m")], by=c("NestID", "BaitID"))
Shortpot_incomplete<-merge(Shortpot_incomplete, Baits[, c("NestID", "BaitID", "Urbanisation25m", "Urbanisation50m", "Urbanisation100m")], by=c("NestID", "BaitID"))

## Urbanisatietrajecten per vliegtijd toevoegen
Flights_incomplete<-merge(Flights_incomplete, Baits[, c("NestID", "BaitID", "Traject25m", "Traject50m", "Traject100m")], by=c("NestID", "BaitID"), all=TRUE)
Shortind_incomplete<-merge(Shortind_incomplete, Baits[, c("NestID", "BaitID", "Traject25m", "Traject50m", "Traject100m")], by=c("NestID", "BaitID"))
Shortpot_incomplete<-merge(Shortpot_incomplete, Baits[, c("NestID", "BaitID", "Traject25m", "Traject50m", "Traject100m")], by=c("NestID", "BaitID"))

## Gewicht individu per vliegtijd toevoegen
Flights_incomplete<-merge(Flights_incomplete, Individuals[, c("NestID", "BaitID","ColorInd", "Weight_ind")], by=c("NestID", "BaitID", "ColorInd"), all=TRUE)
Shortind_incomplete<-merge(Shortind_incomplete, Individuals[, c("NestID", "BaitID", "ColorInd", "Weight_ind")], by=c("NestID", "BaitID", "ColorInd"))
Shortpot_incomplete<-merge(Shortpot_incomplete, Individuals[, c("NestID", "BaitID", "ColorInd","Weight_ind")], by=c("NestID", "BaitID", "ColorInd"))

## Nesthoogte per vliegtijd toevoegen
Flights_incomplete<-merge(Flights_incomplete, Nests[, c("NestID", "Height")], by=c("NestID"), all=TRUE)
Shortind_incomplete<-merge(Shortind_incomplete, Nests[, c("NestID", "Height")], by=c("NestID"))
Shortpot_incomplete<-merge(Shortpot_incomplete, Nests[, c("NestID", "Height")], by=c("NestID"))

library(ggplot2)
library(ggpubr)

Volgende datasets zijn gecreëerd:

Voor het model: Flight time ~ Distance gebruiken we de dataset vliegtijden per individu Omdat we hiermee de theoretische regel 1min=100m kunnen verifiëren. De imkers nemen hiervoor altijd kortste meting

Voor modellen met weerparameters, gewicht, urbanisatie: Hiervoor nemen we telkens de hele dataset, omdat elke meting van deze factoren afhangt.

Datapunten op 2km weglaten

We gaan verder met de dataset zonder de outliers in Melle

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
Flights2_incomplete<-Flights_incomplete %>%  filter(NestID!=1)
Shortind2_incomplete<-Shortind_incomplete %>%  filter(NestID!=1)
Shortpot2_incomplete<-Shortpot_incomplete %>%  filter(NestID!=1)

# ID maken per individu
Flights2_incomplete$Individualcode <- paste(Flights2_incomplete$NestID, Flights2_incomplete$BaitID,Flights2_incomplete$ColorInd, sep="_")
Shortind2_incomplete$Individualcode <- paste(Shortind2_incomplete$NestID, Shortind2_incomplete$BaitID,Shortind2_incomplete$ColorInd, sep="_")

VRAAG: Hoe grafiek maken van parameters mixed model?

1.1) ForagingSpeed vs Temperature

Graphs

Model Output

  • Licht significant

  • Normality ok!

library(lmerTest)
## Loading required package: lme4
## Loading required package: Matrix
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
library(lme4)

model_temp_all<-lmer(ForagingSpeed ~ Temperature + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_temp_all)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Temperature + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 453.6
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.27512 -0.54144  0.04639  0.43428  2.98830 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.06269  0.2504  
##  NestID:BaitID  (Intercept) 0.89795  0.9476  
##  NestID         (Intercept) 0.60778  0.7796  
##  Residual                   0.38374  0.6195  
## Number of obs: 183, groups:  Individualcode, 58; NestID:BaitID, 40; NestID, 21
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)  
## (Intercept)  1.58320    0.70811 53.55587   2.236   0.0296 *
## Temperature  0.07730    0.03262 64.71664   2.370   0.0208 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## Temperature -0.933
anova(model_temp_all, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##             Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)  
## Temperature 2.1548  2.1548     1 64.717  5.6152 0.0208 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
res<-residuals(model_temp_all)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.98907, p-value = 0.1727
qqnorm(res)
qqline(res)

1.2) Flight time vs Distance + Temperature

Graph

library(knitr)
library(kableExtra)
## Warning in !is.null(rmarkdown::metadata$output) && rmarkdown::metadata$output
## %in% : 'length(x) = 2 > 1' in coercion to 'logical(1)'
## 
## Attaching package: 'kableExtra'
## The following object is masked from 'package:dplyr':
## 
##     group_rows
library("plot3D")

x <- Flights2_incomplete$Distance
y <- Flights2_incomplete$Temperature
z <- Flights2_incomplete$Flighttime_min

fit <- lm(z ~ x + y, na.action=na.exclude)
x.pred <- seq(min(x[!is.na(x)]), max(x[!is.na(x)]), length.out = 20)
y.pred <- seq(min(y[!is.na(y)]), max(y[!is.na(y)]), length.out = 20)
xy <- expand.grid( x = x.pred, y = y.pred)
z.pred <- matrix(predict(fit, newdata = xy), 
                 nrow = 20, ncol = 20)
fitpoints <- predict(fit)

scatter3D(x, y, z, pch = 19, cex = 0.6, colvar=FALSE, col="dodgerblue3", theta = 210, phi = 10, bty="u", col.panel ="grey93", expand =0.4, col.grid = "white", xlab = "Distance", ylab = "Temperature", zlab = "Flight time", surf = list(x = x.pred, y = y.pred, z = z.pred,  
facets = TRUE, col=ramp.col(col = c("dodgerblue4", "seagreen2"), n = 100, alpha=0.8), fit = fitpoints, border="black"),main = "Flight time vs Distance + Temperature")

Met plotly

Had met deze link problemen met expand.grid https://stackoverflow.com/questions/38331198/add-regression-plane-to-3d-scatter-plot-in-plotly

Dan maar grid dat van hierboven gebruikt, maar nu klopt er precies iets niet? Alle datapunten liggen boven het oppervlak.

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(tidyverse)
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ tibble  3.1.8     ✔ purrr   1.0.1
## ✔ tidyr   1.2.1     ✔ stringr 1.5.0
## ✔ readr   2.1.4     ✔ forcats 1.0.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ tidyr::expand()          masks Matrix::expand()
## ✖ plotly::filter()         masks dplyr::filter(), stats::filter()
## ✖ kableExtra::group_rows() masks dplyr::group_rows()
## ✖ dplyr::lag()             masks stats::lag()
## ✖ tidyr::pack()            masks Matrix::pack()
## ✖ tidyr::unpack()          masks Matrix::unpack()
FlightsNoNA<-Flights2_incomplete %>%  filter(Flighttime_min!="NA")
FlightsNoNA<-FlightsNoNA %>%  filter(Temperature!="NA")
fig <- plot_ly(FlightsNoNA, x = ~Distance, y = ~Temperature, z = ~Flighttime_min, size=1)
fig <- fig %>% add_markers()
fig <- fig %>% layout(scene = list(xaxis = list(title = 'Distance'),
                     yaxis = list(title = 'Temperature'),
                     zaxis = list(title = 'Flight time (min)')))
p2 <- add_trace(p = fig,
                z = z.pred,
                x = seq(2100, 0, by = -100),
                y = seq(0, 30, by = 10),
                type = "surface")
p2

Model Ouput

  • Temperatuur licht significant

  • Normality niet ok!

model_tempdist_all<-lmer(Flighttime_min ~ Distance + Temperature + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.exclude, data=Flights2_incomplete)
## boundary (singular) fit: see help('isSingular')
summary(model_tempdist_all)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Flighttime_min ~ Distance + Temperature + (1 | NestID) + (1 |  
##     NestID:BaitID) + (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 792.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.4975 -0.4453 -0.1665  0.1776  4.4026 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.0000   0.000   
##  NestID:BaitID  (Intercept) 0.1537   0.392   
##  NestID         (Intercept) 2.9137   1.707   
##  Residual                   3.3284   1.824   
## Number of obs: 183, groups:  Individualcode, 58; NestID:BaitID, 40; NestID, 21
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)  4.035344   1.123629 45.213083   3.591 0.000807 ***
## Distance     0.006742   0.001277 53.238907   5.279 2.45e-06 ***
## Temperature -0.113402   0.056404 56.644654  -2.011 0.049146 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Distnc
## Distance    -0.044       
## Temperature -0.835 -0.382
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
res<-residuals(model_tempdist_all)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.81697, p-value = 6.91e-14
qqnorm(res)
qqline(res)

2) ForagingSpeed vs Cloudcoverage

Graphs

ggplot(Flights2_incomplete, aes(x=Cloudcoverage, y=ForagingSpeed)) + geom_point(color="lightblue") + geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="darkblue") + ggtitle("All data | eigen metingen")+ theme(plot.title = element_text(hjust = 0.5, size=10))

Model Ouput

  • Niet significant

  • Normality ok!

model_cloud_all<-lmer(ForagingSpeed ~ Cloudcoverage + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_cloud_all)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Cloudcoverage + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 370.2
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.22546 -0.53602  0.03464  0.51058  2.86264 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.08882  0.2980  
##  NestID:BaitID  (Intercept) 0.53308  0.7301  
##  NestID         (Intercept) 1.57012  1.2530  
##  Residual                   0.39844  0.6312  
## Number of obs: 152, groups:  Individualcode, 39; NestID:BaitID, 26; NestID, 15
## 
## Fixed effects:
##               Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)     2.7550     0.4029  17.6829   6.838 2.34e-06 ***
## Cloudcoverage   0.1465     0.2897 118.6616   0.506    0.614    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## Cloudcoverg -0.344
anova(model_cloud_all, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Cloudcoverage 0.10191 0.10191     1 118.66  0.2558  0.614
res<-residuals(model_cloud_all)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.99199, p-value = 0.553
qqnorm(res)
qqline(res)

3.1) ForagingSpeed vs Windspeed

Graphs

Telkens voor de modellen

ForagingSpeed ~ Windspeed

ForagingSpeed ~ Windspeed²

plot1<-ggplot(Flights2_incomplete, aes(x=Windspeed, y=ForagingSpeed)) + geom_point(color="khaki3") + geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="olivedrab") + ggtitle("All data | eigen metingen")+ theme(plot.title = element_text(hjust = 0.5, size=10))

plot2<-ggplot(Flights2_incomplete, aes(x=Windspeed, y=ForagingSpeed)) + geom_point(color="khaki3") + geom_smooth(method="lm", formula =y ~ I(x^2), se=TRUE, fullrange=FALSE, level=0.95, color="olivedrab") + ggtitle("All data | eigen metingen")+ theme(plot.title = element_text(hjust = 0.5, size=10))


ggarrange(plot1, plot2 + rremove("x.text"), 
          labels = c("A", "B"),
          ncol = 2, nrow = 1)

Model Output

  • Beide modellen licht significant

  • Beide normality ok!

model_wind_all<-lmer(ForagingSpeed ~ Windspeed + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_wind_all)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Windspeed + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 432.9
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.42152 -0.49360  0.05452  0.47633  2.79858 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.08932  0.2989  
##  NestID:BaitID  (Intercept) 1.01558  1.0078  
##  NestID         (Intercept) 1.03080  1.0153  
##  Residual                   0.37163  0.6096  
## Number of obs: 174, groups:  Individualcode, 52; NestID:BaitID, 37; NestID, 20
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)   3.55166    0.37128  37.77695   9.566 1.23e-11 ***
## Windspeed    -0.19649    0.09909 134.08024  -1.983   0.0494 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##           (Intr)
## Windspeed -0.559
anova(model_wind_all, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
## Windspeed 1.4613  1.4613     1 134.08  3.9321 0.04942 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
model_wind2_all<-lmer(ForagingSpeed ~ I(Windspeed^2) + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_wind2_all)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ I(Windspeed^2) + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 435.3
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.41697 -0.51531  0.05362  0.47376  2.74388 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.08097  0.2846  
##  NestID:BaitID  (Intercept) 1.05901  1.0291  
##  NestID         (Intercept) 0.99293  0.9965  
##  Residual                   0.37094  0.6091  
## Number of obs: 174, groups:  Individualcode, 52; NestID:BaitID, 37; NestID, 20
## 
## Fixed effects:
##                 Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)      3.40359    0.33125  25.08707  10.275 1.78e-10 ***
## I(Windspeed^2)  -0.04991    0.02378 141.46504  -2.099   0.0376 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## I(Wndspd^2) -0.379
anova(model_wind2_all, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##                Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)  
## I(Windspeed^2) 1.6342  1.6342     1 141.47  4.4055 0.0376 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
res<-residuals(model_wind_all)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.98609, p-value = 0.082
qqnorm(res)
qqline(res)

res<-residuals(model_wind2_all)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.98593, p-value = 0.07817
qqnorm(res)
qqline(res)

3.2) ForagingSpeed vs Windspeed | afhankelijk van de windrichting

Hiervoor werd telkens voor elke meting nagegaan of de hoornaar met meewind (tailwind), tegenwind (upwind) of loodrechte wind (perpendicular) te maken had. Dit volgens de formules:

|𝜃flight −𝜃wind| ≤ 45 is tailwind

45 < |𝜃flight −𝜃wind|<135 is (quasi) perpendicular

|𝜃 flight −𝜃wind| ≥135 upwind

Graphs

ggplot(data=subset(Flights2_incomplete, !is.na(Wind)), aes(x= Wind, col=Wind, y=ForagingSpeed)) + geom_boxplot()
## Warning: Removed 6 rows containing non-finite values (`stat_boxplot()`).

ggplot(data=subset(Flights2_incomplete, !is.na(Wind)), aes(x= Windspeed, col=Wind, y=ForagingSpeed)) + geom_point() + facet_grid(~Wind) + geom_smooth(method="lm", formula = y ~ I(x^2), se=TRUE, fullrange=FALSE, level=0.95)
## Warning: Removed 6 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 6 rows containing missing values (`geom_point()`).

Model Output

Anova van Foragingspeed en de 3 windinvloeden

  • interpretatie?
windanova<-lmer(ForagingSpeed ~ Wind + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.exclude, data=Flights2_incomplete)
summary(windanova)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Wind + (1 | NestID) + (1 | NestID:BaitID) + (1 |  
##     Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 404.8
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.33260 -0.52067  0.06443  0.44415  2.85021 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.08166  0.2858  
##  NestID:BaitID  (Intercept) 1.07782  1.0382  
##  NestID         (Intercept) 1.03185  1.0158  
##  Residual                   0.40109  0.6333  
## Number of obs: 161, groups:  Individualcode, 46; NestID:BaitID, 32; NestID, 18
## 
## Fixed effects:
##               Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)    3.00083    0.34415  18.28027   8.720 6.22e-08 ***
## Windtailwind   0.12318    0.35013 154.63228   0.352    0.725    
## Windupwind     0.01683    0.22303 126.67888   0.075    0.940    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Wndtlw
## Windtailwnd -0.243       
## Windupwind  -0.170  0.111

ForagingSpeed vs WindSpeed voor Tailwind dataset

  • Licht significant

  • Normality ok!

data_tailwind<-Flights2_incomplete %>%  filter(Wind!="tailwind")

model_tailwind<-lmer(ForagingSpeed ~ Windspeed + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=data_tailwind)
summary(model_tailwind)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Windspeed + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: data_tailwind
## 
## REML criterion at convergence: 345.5
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.44526 -0.50672  0.05577  0.47831  2.83903 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.09079  0.3013  
##  NestID:BaitID  (Intercept) 1.29700  1.1389  
##  NestID         (Intercept) 1.05582  1.0275  
##  Residual                   0.36635  0.6053  
## Number of obs: 140, groups:  Individualcode, 40; NestID:BaitID, 27; NestID, 14
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)   3.4886     0.4494  22.4414   7.762 8.48e-08 ***
## Windspeed    -0.2467     0.1071 116.7874  -2.305    0.023 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##           (Intr)
## Windspeed -0.531
anova(model_tailwind, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
## Windspeed 1.9459  1.9459     1 116.79  5.3115 0.02295 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
res<-residuals(model_tailwind)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.98601, p-value = 0.1665
qqnorm(res)
qqline(res)

ForagingSpeed vs WindSpeed voor Perpendicular dataset

  • Niet significant

  • Normality ok!

data_perpendicular<-Flights2_incomplete %>%  filter(Wind!="perpendicular")

model_perpendicular<-lmer(ForagingSpeed ~ Windspeed + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=data_perpendicular)
## boundary (singular) fit: see help('isSingular')
summary(model_perpendicular)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Windspeed + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: data_perpendicular
## 
## REML criterion at convergence: 141.7
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.57763 -0.38771  0.07316  0.36289  1.80392 
## 
## Random effects:
##  Groups         Name        Variance  Std.Dev. 
##  Individualcode (Intercept) 0.000e+00 0.000e+00
##  NestID:BaitID  (Intercept) 2.755e+00 1.660e+00
##  NestID         (Intercept) 9.066e-10 3.011e-05
##  Residual                   2.559e-01 5.059e-01
## Number of obs: 57, groups:  Individualcode, 19; NestID:BaitID, 18; NestID, 13
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)   2.4020     0.6653 45.4963   3.610 0.000759 ***
## Windspeed     0.2149     0.2418 53.8531   0.889 0.378077    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##           (Intr)
## Windspeed -0.798
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
anova(model_perpendicular, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Windspeed 0.20218 0.20218     1 53.853  0.7899 0.3781
res<-residuals(model_perpendicular)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.97302, p-value = 0.2311
qqnorm(res)
qqline(res)

ForagingSpeed vs WindSpeed voor Upwind dataset

  • Licht significant

  • Normality ok!

data_upwind<-Flights2_incomplete %>%  filter(Wind!="upwind")

model_upwind<-lmer(ForagingSpeed ~ Windspeed + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=data_upwind)
summary(model_upwind)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Windspeed + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: data_upwind
## 
## REML criterion at convergence: 318
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.27384 -0.54081  0.02262  0.46892  2.60623 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.1159   0.3405  
##  NestID:BaitID  (Intercept) 0.4120   0.6418  
##  NestID         (Intercept) 1.0123   1.0061  
##  Residual                   0.4318   0.6571  
## Number of obs: 125, groups:  Individualcode, 39; NestID:BaitID, 27; NestID, 16
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)   3.6690     0.3986 35.1368   9.205 6.82e-11 ***
## Windspeed    -0.2365     0.1182 66.9413  -2.001   0.0494 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##           (Intr)
## Windspeed -0.633
anova(model_upwind, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##           Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
## Windspeed 1.7295  1.7295     1 66.941   4.005 0.04942 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
res<-residuals(model_upwind)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.99189, p-value = 0.6839
qqnorm(res)
qqline(res)

4) ForagingSpeed vs Weight individual

Graphs

ggplot(Flights2_incomplete, aes(x=Weight_ind, y=ForagingSpeed)) + geom_point(color="plum") + geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="darkorchid4") + ggtitle("All data")+ theme(plot.title = element_text(hjust = 0.5, size=10))

Model Output

  • Niet significant

  • Normality ok!

model_weight_all<-lmer(ForagingSpeed ~ Weight_ind + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_weight_all)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Weight_ind + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 190.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5613 -0.4856  0.1252  0.6123  1.9429 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.02848  0.1688  
##  NestID:BaitID  (Intercept) 0.84028  0.9167  
##  NestID         (Intercept) 0.31026  0.5570  
##  Residual                   0.32267  0.5680  
## Number of obs: 89, groups:  Individualcode, 20; NestID:BaitID, 15; NestID, 10
## 
## Fixed effects:
##             Estimate Std. Error     df t value Pr(>|t|)  
## (Intercept)   2.6035     1.2768 9.3705   2.039   0.0706 .
## Weight_ind    0.1376     3.6587 9.9498   0.038   0.9707  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## Weight_ind -0.968
anova(model_weight_all, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##               Sum Sq   Mean Sq NumDF  DenDF F value Pr(>F)
## Weight_ind 0.0004566 0.0004566     1 9.9498  0.0014 0.9707
res<-residuals(model_weight_all)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.98157, p-value = 0.2383
qqnorm(res)
qqline(res)

5) ForagingSpeed vs Urbanisation

Graphs

Urbanisatiecirkels niet berekend, meteen trajecten genomen want die zijn betere maatstaf

Telkens voor buffers van 25m, 50m en 100m

plot31<-ggplot(data=subset(Flights2_incomplete, !is.na(Observer)), aes(x=Traject25m, y=ForagingSpeed)) + geom_point(col="slateblue1") + geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="slateblue4")
               
plot32<-ggplot(data=subset(Flights2_incomplete, !is.na(Observer)), aes(x=Traject50m, y=ForagingSpeed)) + geom_point(col="slateblue1") + geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="slateblue4")

plot33<-ggplot(data=subset(Flights2_incomplete, !is.na(Observer)), aes(x=Traject100m, y=ForagingSpeed)) + geom_point(col="slateblue1") + geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="slateblue4")

ggarrange(plot31, plot32, plot33 + rremove("x.text"), 
          labels = c("A", "B", "C"),
          ncol = 2, nrow = 2)
## Warning: Removed 26 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 26 rows containing missing values (`geom_point()`).
## Warning: Removed 26 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 26 rows containing missing values (`geom_point()`).
## Warning: Removed 26 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 26 rows containing missing values (`geom_point()`).

Model Output

25m

  • Hoogsignificant

  • Normality niet ok!

model_urb25<-lmer(ForagingSpeed ~ Traject25m + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_urb25)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Traject25m + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 642.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5620 -0.4494  0.0070  0.3752  5.1689 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.4807   0.6933  
##  NestID:BaitID  (Intercept) 0.5523   0.7432  
##  NestID         (Intercept) 0.3623   0.6019  
##  Residual                   0.4452   0.6672  
## Number of obs: 235, groups:  Individualcode, 94; NestID:BaitID, 70; NestID, 34
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)   3.7977     0.2351 43.3198  16.157  < 2e-16 ***
## Traject25m   -4.6452     1.2114 52.0047  -3.835 0.000342 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## Traject25m -0.659
anova(model_urb25, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## Traject25m  6.546   6.546     1 52.005  14.704 0.0003416 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
res<-residuals(model_urb25)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.93238, p-value = 6.425e-09
qqnorm(res)
qqline(res)

50m

  • Hoogsignificant

  • Normality niet ok!

model_urb50<-lmer(ForagingSpeed ~ Traject50m + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_urb50)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Traject50m + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 638.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5420 -0.4551  0.0056  0.3876  5.1860 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.4712   0.6865  
##  NestID:BaitID  (Intercept) 0.5083   0.7130  
##  NestID         (Intercept) 0.3403   0.5833  
##  Residual                   0.4455   0.6675  
## Number of obs: 235, groups:  Individualcode, 94; NestID:BaitID, 70; NestID, 34
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)   3.9254     0.2391 42.3283  16.417  < 2e-16 ***
## Traject50m   -5.4862     1.2565 47.6229  -4.366 6.78e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## Traject50m -0.693
anova(model_urb50, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## Traject50m 8.4939  8.4939     1 47.623  19.064 6.778e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
res<-residuals(model_urb50)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.93274, p-value = 6.912e-09
qqnorm(res)
qqline(res)

100m

  • Hoogsignificant

  • Normality niet ok!

model_urb100<-lmer(ForagingSpeed ~ Traject100m + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_urb100)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Traject100m + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 639.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.5431 -0.4733  0.0107  0.3739  5.1785 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.4760   0.6899  
##  NestID:BaitID  (Intercept) 0.5112   0.7150  
##  NestID         (Intercept) 0.3427   0.5854  
##  Residual                   0.4463   0.6680  
## Number of obs: 235, groups:  Individualcode, 94; NestID:BaitID, 70; NestID, 34
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)   3.9722     0.2504 40.2620  15.862  < 2e-16 ***
## Traject100m  -5.5690     1.3095 43.0286  -4.253 0.000112 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## Traject100m -0.723
anova(model_urb100, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##             Sum Sq Mean Sq NumDF  DenDF F value    Pr(>F)    
## Traject100m 8.0718  8.0718     1 43.029  18.087 0.0001116 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
res<-residuals(model_urb100)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.93308, p-value = 7.391e-09
qqnorm(res)
qqline(res)

6) Flight error vs urbanisation (25m, 50m, 100m)

Flight error is the difference between the actual angle from the bait to the nest and the flight direction I measured.

Graphs

plot28<-ggplot(data=subset(Flights2_incomplete, !is.na(Observer)), aes(x=Traject25m, y=FlightError)) + geom_point(col="hotpink1") + geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="violetred4")

plot29<-ggplot(data=subset(Flights2_incomplete, !is.na(Observer)), aes(x=Traject50m, y=FlightError)) + geom_point(col="hotpink1") + geom_smooth(method="lm", formula =y ~ x , se=TRUE, fullrange=FALSE, level=0.95, color="violetred4")

plot30<-ggplot(data=subset(Flights2_incomplete, !is.na(Observer)), aes(x=Traject100m, y=FlightError)) + geom_point(col="hotpink1")+ geom_smooth(method="lm", formula =y ~ x, se=TRUE, fullrange=FALSE, level=0.95, color="violetred4")

ggarrange(plot28, plot29, plot30 + rremove("x.text"), 
          labels = c("A", "B", "C"),
          ncol = 2, nrow = 2)
## Warning: Removed 9 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 9 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 9 rows containing missing values (`geom_point()`).
## Warning: Removed 9 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 9 rows containing missing values (`geom_point()`).

Model Output

  • Allemaal niet significant

  • Allemaal normality niet ok!

model_errurb25<-lmer(FlightError ~ Traject25m + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_errurb25)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: FlightError ~ Traject25m + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 1953.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7835 -0.1943 -0.0498  0.0260  6.9864 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 132.46   11.509  
##  NestID:BaitID  (Intercept) 120.72   10.987  
##  NestID         (Intercept)  14.39    3.793  
##  Residual                    55.18    7.428  
## Number of obs: 252, groups:  Individualcode, 111; NestID:BaitID, 85; NestID, 34
## 
## Fixed effects:
##             Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)   17.822      2.742 39.345   6.500 1.01e-07 ***
## Traject25m    -3.587     14.693 48.241  -0.244    0.808    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## Traject25m -0.704
anova(model_errurb25, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Traject25m  3.288   3.288     1 48.241  0.0596 0.8082
model_errurb50<-lmer(FlightError ~ Traject50m + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_errurb50)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: FlightError ~ Traject50m + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 1953.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7932 -0.1966 -0.0506  0.0269  6.9836 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 133.14   11.539  
##  NestID:BaitID  (Intercept) 121.88   11.040  
##  NestID         (Intercept)  12.38    3.519  
##  Residual                    55.11    7.423  
## Number of obs: 252, groups:  Individualcode, 111; NestID:BaitID, 85; NestID, 34
## 
## Fixed effects:
##             Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)   16.648      2.843 40.119   5.856 7.46e-07 ***
## Traject50m     5.526     15.376 43.301   0.359    0.721    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr)
## Traject50m -0.734
anova(model_errurb50, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##            Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Traject50m 7.1187  7.1187     1 43.301  0.1292  0.721
model_errurb100<-lmer(FlightError ~ Traject100m + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model_errurb100)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: FlightError ~ Traject100m + (1 | NestID) + (1 | NestID:BaitID) +  
##     (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 1953.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7933 -0.1970 -0.0510  0.0299  6.9832 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 132.90   11.528  
##  NestID:BaitID  (Intercept) 122.55   11.070  
##  NestID         (Intercept)  11.96    3.459  
##  Residual                    55.11    7.424  
## Number of obs: 252, groups:  Individualcode, 111; NestID:BaitID, 85; NestID, 34
## 
## Fixed effects:
##             Estimate Std. Error     df t value Pr(>|t|)    
## (Intercept)   16.603      2.959 40.821   5.611 1.57e-06 ***
## Traject100m    5.750     16.000 41.498   0.359    0.721    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## Traject100m -0.759
anova(model_errurb100, ddf="Satterthwaite", type=3)
## Type III Analysis of Variance Table with Satterthwaite's method
##             Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Traject100m 7.1168  7.1168     1 41.498  0.1291 0.7211
res<-residuals(model_urb25)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.93238, p-value = 6.425e-09
qqnorm(res)
qqline(res)

res<-residuals(model_urb50)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.93274, p-value = 6.912e-09
qqnorm(res)
qqline(res)

res<-residuals(model_urb100)
shapiro.test(res)
## 
##  Shapiro-Wilk normality test
## 
## data:  res
## W = 0.93308, p-value = 7.391e-09
qqnorm(res)
qqline(res)

Nu verder werken met KMI of eigen gegevens bij model selection?

Model Selection

fullmodel<-lmer(ForagingSpeed ~ Traject100m + Windspeed + Temperature + Cloudcoverage + Weight_ind + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
## boundary (singular) fit: see help('isSingular')
summary(fullmodel)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## ForagingSpeed ~ Traject100m + Windspeed + Temperature + Cloudcoverage +  
##     Weight_ind + (1 | NestID) + (1 | NestID:BaitID) + (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 170
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.7356 -0.5550  0.1066  0.5685  1.8733 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.03398  0.1843  
##  NestID:BaitID  (Intercept) 0.31924  0.5650  
##  NestID         (Intercept) 0.00000  0.0000  
##  Residual                   0.30817  0.5551  
## Number of obs: 88, groups:  Individualcode, 20; NestID:BaitID, 15; NestID, 10
## 
## Fixed effects:
##               Estimate Std. Error       df t value Pr(>|t|)   
## (Intercept)    4.99457    2.20523 29.00627   2.265  0.03117 * 
## Traject100m   -7.86760    2.58297 18.69255  -3.046  0.00674 **
## Windspeed     -0.17727    0.16151  9.98177  -1.098  0.29815   
## Temperature   -0.03233    0.08430 27.81931  -0.384  0.70425   
## Cloudcoverage  1.31882    0.39406 24.27275   3.347  0.00266 **
## Weight_ind    -1.44193    2.55293 10.61380  -0.565  0.58394   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Trj100 Wndspd Tmprtr Cldcvr
## Traject100m -0.789                            
## Windspeed    0.204 -0.409                     
## Temperature -0.888  0.775 -0.384              
## Cloudcoverg  0.241 -0.388  0.127 -0.327       
## Weight_ind  -0.545  0.188  0.084  0.150 -0.048
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
model1<-lmer(ForagingSpeed ~ Traject100m + Windspeed + Cloudcoverage + Weight_ind + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
## boundary (singular) fit: see help('isSingular')
summary(model1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## ForagingSpeed ~ Traject100m + Windspeed + Cloudcoverage + Weight_ind +  
##     (1 | NestID) + (1 | NestID:BaitID) + (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 167
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.6747 -0.5380  0.1197  0.5758  1.9362 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.03317  0.1821  
##  NestID:BaitID  (Intercept) 0.28865  0.5373  
##  NestID         (Intercept) 0.00000  0.0000  
##  Residual                   0.30791  0.5549  
## Number of obs: 88, groups:  Individualcode, 20; NestID:BaitID, 15; NestID, 10
## 
## Fixed effects:
##               Estimate Std. Error      df t value Pr(>|t|)   
## (Intercept)     4.2462     0.9816 10.7873   4.326  0.00126 **
## Traject100m    -7.0951     1.5703  8.0472  -4.518  0.00193 **
## Windspeed      -0.1992     0.1439  9.4887  -1.384  0.19790   
## Cloudcoverage   1.2675     0.3639 22.4685   3.483  0.00206 **
## Weight_ind     -1.3126     2.4408 10.0199  -0.538  0.60249   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Trj100 Wndspd Cldcvr
## Traject100m -0.343                     
## Windspeed   -0.325 -0.195              
## Cloudcoverg -0.121 -0.231  0.017       
## Weight_ind  -0.906  0.115  0.155  0.007
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
model2<-lmer(ForagingSpeed ~ Traject100m + Windspeed + Cloudcoverage + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Traject100m + Windspeed + Cloudcoverage + (1 |  
##     NestID) + (1 | NestID:BaitID) + (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 343.7
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.46705 -0.53111  0.00685  0.48244  2.85559 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.09978  0.3159  
##  NestID:BaitID  (Intercept) 0.39334  0.6272  
##  NestID         (Intercept) 0.25303  0.5030  
##  Residual                   0.37363  0.6113  
## Number of obs: 152, groups:  Individualcode, 39; NestID:BaitID, 26; NestID, 15
## 
## Fixed effects:
##                Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)     4.99137    0.43247  22.10904  11.542 7.87e-11 ***
## Traject100m    -8.09188    1.46500  13.92745  -5.523 7.64e-05 ***
## Windspeed      -0.29289    0.09917  81.93301  -2.953   0.0041 ** 
## Cloudcoverage   0.32661    0.27303 124.69507   1.196   0.2339    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Trj100 Wndspd
## Traject100m -0.661              
## Windspeed   -0.454 -0.049       
## Cloudcoverg -0.180 -0.230  0.106
model3<-lmer(ForagingSpeed ~ Traject100m + Windspeed + (1|NestID) + (1|NestID:BaitID) + (1|Individualcode), na.action=na.omit, data=Flights2_incomplete)
summary(model3)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: ForagingSpeed ~ Traject100m + Windspeed + (1 | NestID) + (1 |  
##     NestID:BaitID) + (1 | Individualcode)
##    Data: Flights2_incomplete
## 
## REML criterion at convergence: 412.1
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.53652 -0.49591  0.01821  0.49551  2.83727 
## 
## Random effects:
##  Groups         Name        Variance Std.Dev.
##  Individualcode (Intercept) 0.08236  0.2870  
##  NestID:BaitID  (Intercept) 0.93614  0.9675  
##  NestID         (Intercept) 0.02917  0.1708  
##  Residual                   0.37294  0.6107  
## Number of obs: 174, groups:  Individualcode, 52; NestID:BaitID, 37; NestID, 20
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)   4.87080    0.36651  30.78189  13.290 2.72e-14 ***
## Traject100m  -7.39979    1.32907  19.45673  -5.568 2.09e-05 ***
## Windspeed    -0.20583    0.09498 138.14425  -2.167    0.032 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Trj100
## Traject100m -0.655       
## Windspeed   -0.551 -0.018
library(cAIC4)
## Loading required package: stats4
## Loading required package: nlme
## 
## Attaching package: 'nlme'
## The following object is masked from 'package:lme4':
## 
##     lmList
## The following object is masked from 'package:dplyr':
## 
##     collapse
library(MASS)
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:plotly':
## 
##     select
## The following object is masked from 'package:dplyr':
## 
##     select
library(AICcmodavg)
## 
## Attaching package: 'AICcmodavg'
## The following object is masked from 'package:lme4':
## 
##     checkConv
AIC(fullmodel)
## [1] 190.0063
AIC(model1)
## [1] 185.0204
AIC(model2)
## [1] 359.7193
AIC(model3)
## [1] 426.0821

Multicollinearity check

library(ggcorrplot)
library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:purrr':
## 
##     some
## The following object is masked from 'package:dplyr':
## 
##     recode
datacor<-Flights2_incomplete[, c("Temperature", "Cloudcoverage", "Windspeed", "Weight_ind", "Traject100m")]
source("~/GitHub/vespa_analyses/Input/HighstatLibV10.R") 
corvif(datacor)
## 
## 
## Variance inflation factors
## 
##                   GVIF
## Temperature   6.054309
## Cloudcoverage 1.354508
## Windspeed     1.330242
## Weight_ind    1.441363
## Traject100m   6.708611
cormat <- round(cor(datacor, use = "pairwise.complete.obs"), 2)
ggcorrplot(cormat, lab= TRUE, type = "lower", ggtheme = ggplot2::theme_gray,
   colors = c("#6D9EC1", "white", "#E46726"))

plot(Temperature~Traject100m, data=Flights2_incomplete)

Eerder toeval dat Temperature en Traject100m gecorreleeerd zijn?